/*
 * Supply.hpp
 *
 *  Created on: 09-01-2011
 *      Author: Piotr
 */

#pragma once

#include "Element.hpp"
#include "utils/RangedValue.hpp"

/*
 * Base class for the element of the world which is a supply. A supply can either be eaten or spoiled.
 */
class Supply: public Element
{
	public:
		static const float SIZE;

	protected:
		static const float DEFAULT_SPOILAGE_STEP;
		RangedValue<float> amount;
		RangedValue<float> spoilageTime;

	public:
		Supply();
		Supply(float amount, RangedValue<float> spoilageTime);
		Supply(const Supply& other);
		explicit Supply(const Vector& position);
		virtual void updateWithDeltaTime(float deltaTimeInSeconds);
		bool isEmpty() const;
		float getAmount() const;
		void decreaseAmount(float decreaseAmount);
		const RangedValue<float>& getSpoilageTime() const;

		virtual void accept(ElementsVisitor& visitor) = 0;

	private:
		virtual float getSpoilageStep() const;
};
